FROM python:3.11.3-slim as builder

COPY ./ /ygcrm_fastapi
WORKDIR /ygcrm_fastapi

run  \
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/ && \
pip config set install.trusted-host mirrors.aliyun.com && \
pip install poetry==1.8.5  && \
poetry export --without-hashes -f requirements.txt --output requirements.txt && \
pip install -r requirements.txt
##poetry install --no-root --only main
#pip install -r requirements.txt --index-url http://qzj.com:3141/root/pypi/+simple/ --trusted-host qzj.com
## poetry install


FROM python:3.11.3-slim
MAINTAINER Tony <wuyong@winning.com.cn>

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /ygcrm_fastapi /ygcrm_fastapi
WORKDIR /ygcrm_fastapi
USER root
EXPOSE 8000

# 设置容器启动时运行的命令
CMD ["/bin/sh", "start.sh"]




